package Controller.StudentServlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import Dao.StudentDao;
import bean.Student;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@WebServlet("/select_student")
public class student_select extends HttpServlet {
    StudentDao sDao = new StudentDao();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        List<Student> list = sDao.selectAll();
        req.setAttribute("student_list", list);
        req.getRequestDispatcher("StudentInfoSelect.jsp").forward(req, resp);
    }
}
